package com.wfd.spring;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author wfd
 * @create 2021/11/17 15:25
 * @description
 */
public class BeanFactory {
    
    private Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<>(256);
    
    public void registerBeanDefinition(String beanName, BeanDefinition beanDefinition) {
        this.beanDefinitionMap.put(beanName, beanDefinition);
    }
    
    public Object getBean(String beanName) {
        return this.beanDefinitionMap.get(beanName).getBean();
    }
}
